#include //////// SERVO AND LED GLOBAL VARIABLES ///////// Servo myservo; // create servo object to control a servo int pos = 0; // variable to store the servo position static int switchPin = PB0; //static int led_pin1 = 10; static int led_pin2 = PD6; // static int servo_pin = PD5; int minutes = 60000; // = 1 minuit in milliseconds int track_time(); // time tracking variable using the for_loop int second = 1000; // = 1 second void setup() { // set the switch as an input: pinMode(switchPin, INPUT); // set all the other pins you're using as outputs: pinMode(led_pin2, OUTPUT); //pinMode(servo_pin, OUTPUT); //myservo.attach(servo_pin); // attaches the servo on pin 9 to the servo object } void loop() { delay(second); if (digitalRead(switchPin) == HIGH) // check if the pushbutton is pressed. If it is, the buttonState is HIGH: { /// evening light on /// digitalWrite(led_pin2, HIGH); // turn the LED on for (int track_time = 0; track_time <= 2; track_time++) /// Wait for a specified time /// { delay(second); } /// morning light off /// digitalWrite(led_pin2, LOW); // turn the LED off for (int track_time = 1; track_time <= 3; track_time++) { delay(second); } } }